container: Don't create too-large clips
authorMatthias Clasen <mclasen@redhat.com>
Wed, 20 Jan 2016 18:42:45 +0000 (13:42 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 20 Jan 2016 18:44:34 +0000 (13:44 -0500)
gdk_rectangle_union will happily add all the worlds pixels
to the union if the initial rectangle is initialized to all
zeros. Therefore, explicitly check for an empty rectangle
before calling it.

gtk/gtkcontainer.c

index 86501d70401d565c9649662a471c5df56e73345d..090b4d71004fb34392b2558b9c7bf2ee86343543 100644 (file)
@@ -3686,8 +3686,9 @@ gtk_container_should_propagate_draw (GtkContainer   *container,
 
 static void
 union_with_clip (GtkWidget *widget,
-                 gpointer   clip)
+                 gpointer   data)
 {
+  GdkRectangle *clip = data;
   GtkAllocation widget_clip;
 
   if (!gtk_widget_is_visible (widget) ||
@@ -3696,7 +3697,10 @@ union_with_clip (GtkWidget *widget,
 
   gtk_widget_get_clip (widget, &widget_clip);
 
-  gdk_rectangle_union (&widget_clip, clip, clip);
+  if (clip->width == 0 || clip->height == 0)
+    *clip = widget_clip;
+  else
+    gdk_rectangle_union (&widget_clip, clip, clip);
 }
 
 void